# --*--coding: utf-8 --*--
__project__ = 'TestHomeWork'
__fileName = 'manage'
__author = 'admin'
__time = '2021/5/8 11:08'
__product__ = 'PyCharm'

from flask import Flask, render_template, request
import pymysql

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('login.html')


@app.route('/commi')
def commit():
    conn = pymysql.connect(host="49.233.39.160", user="user", passwd="leboAa!#$123", database="lebo16", port=3306,
                           charset='utf8')
    cur = conn.cursor(pymysql.cursors.DictCursor)
    # 请求获取name
    userName = request.args["loginname"]
    stuNo = eval(request.args["pwd"])
    sql = "select * from student where studentNo=%s and name=%s"
    count = cur.execute(sql,[stuNo, userName])
    if count >= 1:
        stuMsg = cur.fetchone()
        print(stuMsg)
    else:
        print('不存在')

    cur.close()
    conn.close()
    data=[userName,stuNo]
    return  render_template('main.html',data=data)

app.debug=True
app.run()
